<template>
	<div>
    <v-app-bar
        color="#6A76AB"
        dark
    >
      <template v-slot:img="{ props }">
        <v-img
          v-bind="props"
          gradient="to top right, rgba(100,115,201,.7), rgba(25,32,72,.7)"
        ></v-img>
      </template>
      <!--<v-app-bar-nav-icon></v-app-bar-nav-icon>-->
      <v-toolbar-title>会员中心</v-toolbar-title>

      <div class="flex-grow-1"></div>

      <v-btn icon @click="back">
        <v-icon>keyboard_backspace</v-icon>
      </v-btn>
    </v-app-bar>
        <v-container>
    <v-card
    class="mx-auto"
  >
    <v-img
      :src="head_img"
      height="200px"
    ></v-img>

    <v-card-title>
      <div>尊贵的{{ member.text }}</div>
      <span class="grey--text subtitle-1">{{ member.desc }} </span>
    </v-card-title>
    <v-card-text>
      <span>会员号:{{ card_no }}</span><br>
      <span>有效期:{{ exp_at }}</span><br>
      </v-card-text>
    <v-card-actions>
      <v-btn
        text
        color="purple"
         @click="show = !show"
      >
        了解更多
      </v-btn>

      <div class="flex-grow-1"></div>
    </v-card-actions>

    <v-expand-transition>
      <div v-show="show">
        <v-card-text>
          一些说明 ...
        </v-card-text>
      </div>
    </v-expand-transition>
  </v-card>
            <v-row>
                

        <v-col>
        </v-col>
      </v-row>
 
        </v-container>
    </div>
</template>
<script>
import { paymember, wxpayjsapi, domain,userinfo } from './../../api/api'
import { yimiaobeauty } from './../../api/oidapi'



export default {
    data: ()=>({
        loding:false,
        show:false,
        name:'',
		phone:'',
    ismember:false,
    member:{
      text: '正在获取您的身份',
      desc:''
    },
    itac:'',
    grade:'',
    item: '',
    cash:'',
    point:'',
    renew_at:'',
    exp_at:'',
    card_no:'',
    head_img:'',
    }),
    methods: {
        back:function(e){
            this.$router.push('/user/center')
        },
    },
    created: function(){

        yimiaobeauty()
        .then((resp)=>{
            var res = resp.data
            console.log(res)
        })
        userinfo(this.$cookies.get("authtoken"))
        .then((resp)=>{
        var res = resp.data
        console.log(res)
        if(res.code==1){
            this.name = res.data.user.name
            this.itac = res.data.user.itac
            this.phone = res.data.user.phone
            this.head_img = res.data.user.head_img
            this.grade = res.data.member.grade
            this.cash = res.data.member.cash
            this.point = res.data.member.point
            this.grade = res.data.member.grade
            this.renew_at = res.data.member.renew_at
            this.exp_at = res.data.member.exp_at
            this.card_no = res.data.member.card_no
            if (res.data.member.grade == 0) {
                this.ismember = true
                this.member.text = "您还不是会员"
                this.member.desc = "无法享受香港优惠"
            }
            if (res.data.member.grade == 1) {
                this.ismember = true
                this.member.text = "会员用户"
                this.member.desc = "您目前可以享受多达数百个产品，最高20%的折扣"
            }
            if (res.data.member.grade == 2) {
                this.ismember = true
                this.member.text = "金卡会员"
                this.member.desc = "您目前可以享受多达数百个产品，最高20%的折扣"
            }
            if (res.data.member.grade == 3) {
                this.ismember = true
                this.member.text = "白金卡会员"
                this.member.desc = "您目前可以享受多达数百个产品，最高20%的折扣"
            }
        }else{
            if(res.result.errcode=2001){
            this.$router.push({path:'/login'})
            }
            console.log("失败")
        }
        })
        .catch((res)=>{
        this.$router.push({path:'/login'})
        
        })
    }
}
</script>
<style scoped>
.headinfo {
    color: #00000055;
}
</style>